/**
 * Created by sun on 2016/9/9.
 */
define(function (require) {
    var app = require('/../js/app');
    require('ui-table');

    app.useModule("ui.table");

    app.controller('client_meCtrl', ['$scope','$http','$filter',function ($scope, $http,$filter){
    $scope.user={};


        //列表
        $scope.orderParams = {
            url: "/admin/customer/list",
            ajax:{orderName:'total',orderWay:'desc'}
        };
        $scope.check= function (id) {
            $scope.viewItemModal=!$scope.viewItemModal;
            $http({
                method: 'POST',
                url: "/admin/customer/getInvites",
                data:{userId:id}
            }).success(function(data) {
                console.log(data)
                $scope.user=data;

            }).error(function() {
            });
        };
        $scope.close= function () {
            $scope.viewItemModal=!$scope.viewItemModal;
        };

        //搜索
        $scope.search = function() {

            $scope.orderParams.ajaxParam=$scope.ctrlScope.itemsearch;

            $scope.orderParams.reload();
        };

        //搜索重置
        $scope.reset=function(){
            $scope.ctrlScope.itemsearch = {};
            $scope.search();

        };


        $scope.onOff=true;
        $scope.order= function (name) {
            if($scope.onOff){
                $scope.orderParams.ajaxParam={orderName:name,orderWay:'desc'};
                $scope.orderParams.reload();
                $scope.onOff=false;
            }else if(!$scope.onOff){
                $scope.orderParams.ajaxParam={orderName:name,orderWay:'Asc'};
                $scope.orderParams.reload();
                $scope.onOff=true;
            }

        }


    }]);


});